home *** CD-ROM | disk | FTP | other *** search
- Path: in1.uu.net!interaccess!usenet
- From: brianmcg@interaccess.com (Brian V. McGroarty)
- Newsgroups: comp.lang.c
- Subject: Re: Q about the float point format......
- Date: 19 Mar 1996 14:47:50 GMT
- Organization: Internet Squire
- Message-ID: <4imhem$12b@nntp.interaccess.com>
- References: <s3032089.15.314E68DD@sparc13.ncu.edu.tw>
- Reply-To: brianmcg@interaccess.com
- NNTP-Posting-Host: d46-isdn.nhe.interaccess.com
- X-Newsreader: Internet Squire 1.20
-
- In your printf statement, add a decimal point and a number between the %
- and the f.
-
- For example:
-
- printf("%.4f", 1234.56789"); /* prints "1234.5678" */
- printf("%.2f", 1234.56789"); /* prints "1234.57" - last digit rounded upward */
- printf("%.9f", 1234.56789"); /* prints "1234.567890000" - zero is filled to
- right */
-
-
-
- Alexander PeaceLand wrote:
- > Could I dynamicly set the digits after the float POINT?
-
- > In other word... I use printf to print the float point number
- > like 123.456789 but in the other time i only
- > want to print 123.456 or 123.4
- > How shall I do? Thanks! :)
-
- > (Forgive me so poor in writing English!)
-
-
-
- ---
- Brian Valters McGroarty -- brianmcg@bix.com
- phone/fax (847) 439-7714
-
-
-
-
-